package com.api.shopapi.mapper;


import com.api.shopapi.entity.NursingSchedulingNoonItem;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author maochuan
 */
@Repository
@Mapper
public interface NursingSchedulingNoonItemMapper {

    @Insert("insert  into nursing_scheduling_noon_item " +
            "(NursingSchedulingNoonItemCode,NursingSchedulingNoonCode,NurseCode,NurseName,NurseAideCode,NurseAideName) " +
            "values (#{nursingSchedulingNoonItem.NursingSchedulingNoonItemCode} ,#{nursingSchedulingNoonItem.NursingSchedulingNoonCode} ,#{nursingSchedulingNoonItem.NurseCode} ," +
            "#{nursingSchedulingNoonItem.NurseName} ,#{nursingSchedulingNoonItem.NurseAideCode} ,#{nursingSchedulingNoonItem.NurseAideName} )")
    int insert(@Param("nursingSchedulingNoonItem") NursingSchedulingNoonItem nursingSchedulingNoonItem);

    @Update("update nursing_scheduling_noon_item set NursingSchedulingNoonCode=#{nursingSchedulingNoonItem.NursingSchedulingNoonCode} ,NurseCode=#{nursingSchedulingNoonItem.NurseCode} ,NurseName=#{nurseSchedulingNoonItem.NurseName} ,NursingAideCode=#{nursingSchedulingNoonItem.NurseAideCode} ,NursingAideName=#{nursingSchedulingNoonItem.NurseAideName} where NursingSchedulingNoonItemCode=#{nursingSchedulingNoonItem.NursingSchedulingNoonItemCode}  ")
    int updateByNursingSchedulingNoonItemCode(@Param("nursingSchedulingNoonItem") NursingSchedulingNoonItem nursingSchedulingNoonItem);

    @Delete("delete from nursing_scheduling_noon_item where NursingSchedulingNoonItemCode=#{nursingSchedulingNoonItemCode} ")
    int deleteByNursingSchedulingNoonItemCode(@Param("nursingSchedulingNoonItemCode") String nursingSchedulingNoonItemCode);

    @Select("select * from nursing_scheduling_noon_item where NursingSchedulingNoonItemCode=#{nursingSchedulingNoonItemCode} limit 1")
    NursingSchedulingNoonItem getByNursingSchedulingNoonItemCode(@Param("nursingSchedulingNoonItemCode")String nursingSchedulingNoonItemCode);

    @Select("select * from nursing_scheduling_noon_item where NursingSchedulingNoonCode=#{nursingSchedulingNoonCode}")
    List<NursingSchedulingNoonItem> getListByNursingSchedulingNoonCode(@Param("nursingSchedulingNoonCode")String nursingSchedulingNoonCode);

    @Delete("delete from nursing_scheduling_noon_item where NursingSchedulingNoonCode=#{nursingSchedulingNoonCode} ")
    int deleteByNurseSchedulingNoonCode(String nursingSchedulingNoonCode);

    @Select("select * from nursing_scheduling_noon_item where NursingSchedulingNoonCode=#{nursingSchedulingNoonCode} and NurseAideCode=#{nurseAideCode} limit 1")
    NursingSchedulingNoonItem getByNursingSchedulingNoonCodeAndNurseAideCode(@Param("nursingSchedulingNoonCode") String nursingSchedulingNoonCode, @Param("nurseAideCode") String nurseAideCode);

    @Select("select * from nursing_scheduling_noon_item where NursingSchedulingNoonCode=#{nursingSchedulingNoonCode} and NurseCode=#{nurseCode} limit 1")
    NursingSchedulingNoonItem getByNursingSchedulingNoonCodeAndNurseCode(@Param("nursingSchedulingNoonCode") String nursingSchedulingNoonCode,@Param("nurseCode") String nurseCode);
}
